package com.xcb.spring.beans;

import java.util.HashMap;
import java.util.Map;

/**
 * bean的内容及元数据，保存在BeanFactory中，包装bean的实体
 * 
 *
 */
public class BeanDefinition {

	private Object bean;

	private Class beanClass;

	private String beanClassName;

	private ScopeEnum scope;

	private PropertyValues propertyValues = new PropertyValues();

	private Map<String,Object> arguments = new HashMap<String,Object>();

	public BeanDefinition() {
	}

	public void setBean(Object bean) {
		this.bean = bean;
	}

	public Class getBeanClass() {
		return beanClass;
	}

	public void setBeanClass(Class beanClass) {
		this.beanClass = beanClass;
	}

	public String getBeanClassName() {
		return beanClassName;
	}

	public void setBeanClassName(String beanClassName) {
		this.beanClassName = beanClassName;
		try {
			this.beanClass = Class.forName(beanClassName);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}

	public ScopeEnum getScope() {
		return scope;
	}

	public void setScope(ScopeEnum scope) {
		this.scope = scope;
	}

	public Object getBean() {
		return bean;
	}

	public PropertyValues getPropertyValues() {
		return propertyValues;
	}

	public void setPropertyValues(PropertyValues propertyValues) {
		this.propertyValues = propertyValues;
	}


	public void setArguments(String key,Object value){
		this.arguments.put(key,value);
	}

	public Object getArguments(String key){
		return this.arguments.get(key);
	}
}
